package com.kai.steering.data.service.entity.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;

import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ToString
@EqualsAndHashCode(callSuper = false)
@TableName(value = "test_question")
public class TestQuestion {
    @TableId(value = "test_question_id", type = IdType.ID_WORKER)
    private String testQuestionId;
    private String testId;
    private String questionId;
    private Integer sort;

    public static List<TestQuestion> generateTestQuestions(String testId,List<String> questionIds ){
        ArrayList<TestQuestion> testQuestions = new ArrayList<>();
        for (int i = 0; i < questionIds.size(); i++) {
            TestQuestion testQuestion = new TestQuestion();
            testQuestion.setTestId(testId);
            testQuestion.setQuestionId(questionIds.get(i));
            testQuestion.setSort(i);
            testQuestions.add(testQuestion);
        }
        return testQuestions;
    }

}
